package Expe6;

/**
 * @Author sy
 * @Date 2022/9/27
 */
public class Expe6T4 {
    public static void main(String[] args) {
        Battery nanfu = new Battery(100);
        System.out.println("该电池储电量为："+nanfu.electAmount);
        Radio radio = new Radio();
        System.out.println("收音机开始使用电池");
        radio.openRadio(nanfu);
        System.out.println("目前储电量为："+nanfu.electAmount);
    }
}
class Battery{
    int electAmount;
    Battery(int amount){
        electAmount = amount;
    }
}
class Radio{
    void openRadio(Battery battery){
        battery.electAmount = battery.electAmount - 10;
    }
}

